package region_search;

import java.sql.*;

/***
 * @author hunter.d
 * @qq 657270652
 * @wx haitao-duan
 * @date 2020/8/10
 **/
public class ClickHouseJdbc {
    public static void main(String[] args) throws Exception {
        Class.forName("ru.yandex.clickhouse.ClickHouseDriver");
        Connection conn = DriverManager.getConnection("jdbc:clickhouse://doitedu03:8123/tutorial");
        Statement stm = conn.createStatement();
        ResultSet rs = stm.executeQuery("select * from hits_v1 limit 10");
        while(rs.next()){
            System.out.println(rs.getObject(1).toString());
            System.out.println(rs.getObject(2).toString());
            System.out.println(rs.getObject(3).toString());
            System.out.println(rs.getObject(4).toString());
        }

        rs.close();
        stm.close();
        conn.close();

    }
}
